FROM eclipse-temurin:17-jre-focal AS builder
WORKDIR /build/
COPY target/dr-octopus-spring.jar .
RUN java -Djarmode=layertools -jar dr-octopus-spring.jar extract


FROM eclipse-temurin:17-jre-focal

LABEL maintainer="Bob <bo.tan@cloudtogo.cn>"


WORKDIR /dr-octopus
COPY --from=builder /build/dependencies/ .
COPY --from=builder /build/snapshot-dependencies/ .
COPY --from=builder /build/spring-boot-loader/ .
COPY --from=builder /build/application/ .


EXPOSE 8080

CMD java $JAVA_OPTS -Dspring.profiles.active=container org.springframework.boot.loader.JarLauncher
